package cn.kgc.tcst004.service.impl;

import cn.kgc.tcst004.dao.UsersMapper;
import cn.kgc.tcst004.pojo.Users;
import cn.kgc.tcst004.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

@Service("usersService")
public class UsersServiceImpl implements UsersService {
    @Autowired
    private UsersMapper usersMapper;

    public UsersMapper getUsersMapper() {
        return usersMapper;
    }

    public void setUsersMapper(UsersMapper usersMapper) {
        this.usersMapper = usersMapper;
    }

    @Override
    public Users selects(Users users) {
        Users list = null;
        try {
            list = usersMapper.selects(users);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return list;
    }
    @Override
    public int insert(Users users) {
        int i = 0;
        try {
            i = usersMapper.insert(users);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return i;
    }

    @Override
    public List<Users> getUsers() {
        return usersMapper.getUsers();
    }
}
